﻿<?php
	include '../inc/conn.php';	session_start();		extract($_POST);	extract($_GET);	unset($_POST,$_GET);	if (isset($act) && isset($id))	{		if ($act == "del"){			$db = new mysql();			$db->delete('eng_ad', "id=".$id);			$db->close();			echo "<script>alert('Data has deleted!!!');window.location='admin_index.php?name=ad';</script>";		}	}?>
<div class="container-fluid">
<? if ($_SESSION['user'] != 1){  
	echo '<script>window.location="userinfo.php"</script>';
 } else {
?><div class="panel panel-primary">    <div class="panel-heading">        <h3 class="panel-title">管理面板>>工程公告</h3>    </div>    <div class="panel-body">	<div>		<table border=0 cellpadding=0 class="table table-striped">		<tr class="success"><th>Item</th><th>公告内容</th><th>时间</th><th>Admin</th></tr><?		$db = new mysql();		$db->query("select * from eng_ad ORDER BY build_date DESC");		$num = $db->db_num_rows();		for($i=0; $i<$num; $i++){			$row = $db->fetch_assoc();			$item = $i + 1;			echo "			<tr>";			echo "<td>$item</td>";			echo "<td>".htmlspecialchars_decode($row['AD_BODY'])."</td>";			echo "<td>".htmlspecialchars_decode($row['BUILD_DATE'])."</td>";			echo "<td><a href='#' onclick=\"javascript:window.open('mod_ad.php?id=${row['ID']}','编写公告', 'height=450, width=748, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');\"><span class=\"glyphicon glyphicon-edit\"></span></a>";			if (isset($_SESSION['admin']))
				echo '&nbsp;|&nbsp;<a href="admin_ad.php?id='.$row['ID'].'&act=del" rel="tooltip" title="删除表内容，当心哦~~~"><font color="red"><span class="glyphicon glyphicon-remove"></span></font></a></td>';			echo "</tr>\n";		}?>		</table>	</div></div></div></div><?
 }	$db->close();?>